/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package probando;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.swing.text.Document;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;


/**
 *
 * @author lab_a112
 */

public class acciones 
{
    public byte[] traeracciones(){
    try { // Call Web Service Operation
            net.webservicex.StockQuote service = new net.webservicex.StockQuote();
            net.webservicex.StockQuoteSoap port = service.getStockQuoteSoap();
            // TODO initialize WS operation arguments here
            String symbol = "yhoo";
            // TODO process result here
            String result = port.getQuote(symbol);
            
            System.out.println("Result = "+ result);
            
            return(result.getBytes());
     } catch (Exception ex) {
            return null;
        }

   }


public void grabarArchivo(byte[] result) {

    try 
    {
        System.out.println("Entro");
        FileOutputStream salida = new FileOutputStream("C:/accionesxml.xml", true);
        salida.write(result);
        salida.close();
    } catch (Exception e) {
       System.out.println("Error de escritura, archivo de errores");
    }
}



}
